Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace dependency on canonical-rails with tag helper #386

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

forkata
Copy link

@forkata forkata commented Nov 29, 2024

Summary

This change removes the dependency on the canonical-rails gem by

  • Adding additional canonical tag test coverage
  • Implementing a simple canonical tag helper
  • Removing dependency on canonical-rails

Considering we are not using some of the features provided by the gem, we decied
to reimplmented the feautres we are using in a simple tag helper. This will
handle the way the starter frontend currently uses the canonical tag helper,
but for storefronts that have more complex requirements, they can add the gem
as a dependency and continue using that.

Upgrade Notes

Usage before upgrading

canonical_tag("example.com")

after upgrading

simple_canonical_tag(host: "example.com")

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

forkata and others added 3 commits November 29, 2024 14:48
In a subsequent commit, we want to replace the canonical tag helper. So
having a record of the current behaviour will help us safely
re-implement the functionality.

We changed the spec type to `:feature` because there seems to be a
database persistence issue when running `:system` tests headfully. (i.e.
`ActiveRecord::RecordNotFound` errors for everything!) Seems like a
configuration problem.

Co-authored-by: benjamin wil <[email protected]>
This replaces the `canonical_tag` helper from `canonical-rails`. This
adds simple canonical tag generation, without all the options the gem
provides, but in a helper that can be customized by application
developers.

This would allow us to remove the `canonical-rails` gem as a dependency
going forward.

Co-authored-by: Benjamin Willems <[email protected]>
Now that we have introduced the `simple_canonical_tag` helper in the
previous commit, this is no longer used and needed.

Co-authored-by: Andrew Stewart <[email protected]>
Co-authored-by: Benjamin Willems <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants